package thread.example2;

/**
 * 常见2种 线程启动方式 Thread 和 Runable
 */
public class ExtendThreadDemo {
    public static void main(String[] args) {

        Runnable r = new MusicThread();
        Thread t = new Thread(r);
        t.start();

        for (int i = 0; i < 50; i++) {
            System.out.println("打游戏"+i);

        }


    }

}


/*class MusicThread extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            System.out.println("播放音乐"+i);
        }
    }
}*/

class MusicThread implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            System.out.println("播放音乐"+i);
        }
    }
}